<!DOCTYPE html>
<html><head>
	    <meta charset="utf-8">
    <title>ThinkPHP5.0</title>

    <meta name="description" content="Dashboard">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--Basic Styles-->
    <link href="__ADMIN__/style/bootstrap.css" rel="stylesheet">
    <link href="__ADMIN__/style/font-awesome.css" rel="stylesheet">
    <link href="__ADMIN__/style/weather-icons.css" rel="stylesheet">

    <!--Beyond styles-->
    <link id="beyond-link" href="__ADMIN__/style/beyond.css" rel="stylesheet" type="text/css">
    <link href="__ADMIN__/style/demo.css" rel="stylesheet">
    <link href="__ADMIN__/style/typicons.css" rel="stylesheet">
    <link href="__ADMIN__/style/animate.css" rel="stylesheet">
    
</head>
<body>
	<!-- 头部 -->
        {include file="common/head"}
	<!-- /头部 -->
	
	<div class="main-container container-fluid">
		<div class="page-container">
			            <!-- Page Sidebar -->
            {include file="common/left"}
            <!-- /Page Sidebar -->
            <!-- Page Content -->
            <div class="page-content">
                <!-- Page Breadcrumb -->
                <div class="page-breadcrumbs">
                    <ul class="breadcrumb">
                                        <li>
                        <a href="#">系统</a>
                    </li>
                                        <li class="active">采集节点管理</li>
                                        </ul>
                </div>
                <!-- /Page Breadcrumb -->

                <!-- Page Body -->
                <div class="page-body">
                    
<button type="button" tooltip="添加用户" class="btn btn-sm btn-azure btn-addon" onClick="javascript:window.location.href = '/admin/user/add.html'"> <i class="fa fa-plus"></i> Add
</button>
<div class="row">
    <div class="col-lg-12 col-sm-12 col-xs-12">
        <div class="widget">
            <div class="widget-body">
                <div class="flip-scroll">
                    <table class="table table-bordered table-hover">
                        <thead class="">
                            <tr>
                                <th class="text-center" width="40%">节点名称</th>
                                <th class="text-center">导出数据</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td align="center">{$noteName}</td>
                                <td align="center">
                                    <select name="cate_id">
                                        <option value="0">选择栏目</option>
                                        {volist name="cateRes" id="cate"}
                                        <option {if condition="$cate['model_id'] neq $modelId"} disabled="disabled" {/if} value="{$cate.id}"><?php echo str_repeat('-', $cate['level']*8);?>{$cate.cate_name}</option>
                                        {/volist}
                                    </select>
                                    <a href="javascript:;" id="export" onclick="exportdata()" class="btn btn-default">导出数据</a>
                                </td>
                            </tr>
                            <tr>
                            <td colspan="2">
                                <div id="loading-1" style="text-align:center; padding:20px 0; display:none;">
                                <img src="__ADMIN__/images/loading-1.gif"> <span>采集中......</span>
                                </div>
                                <div id="dg" style="text-align:center; padding:20px 0; display:none;">
                                <img src="__ADMIN__/images/dg.png"> <span>采集完成！</span>
                                </div>
                                <div id="export_data" style="text-align:center; padding:20px 0; display:none;">
                                <img src="__ADMIN__/images/loading-1.gif"> <span>导出数据中......</span>
                                </div>
                                <div id="export_done" style="text-align:center; padding:20px 0; display:none;">
                                <img src="__ADMIN__/images/dg.png"> <span>导出完成！</span>
                                </div>
                                <div style="text-align:center;">
                                <a id="cjbtn" href="javascript:;" onclick="caiji()" class="btn btn-primary btn-sm shiny">
                                        <i class="menu-icon fa fa-bug"></i> 开始采集
                                </a>
                                </div>
                            </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div>
                	                </div>
            </div>
        </div>
    </div>
</div>

                </div>
                <!-- /Page Body -->
            </div>
            <!-- /Page Content -->
		</div>	
	</div>

	    <!--Basic Scripts-->
    <script src="__ADMIN__/style/jquery_002.js"></script>
    <script src="__ADMIN__/style/bootstrap.js"></script>
    <!--Beyond Scripts-->
    <script src="__ADMIN__/style/beyond.js"></script>
    <script type="text/javascript">
        function caiji(){
            var id={$id};//当前节点id
            $.ajax({
                type:"post",
                dataType:"json",
                data:{id:id},
                url:"{:url('Note/doCaiji')}",
                success:function(data){
                    if(data==1){
                        $("#cjbtn").removeClass("disabled");
                        $("#loading-1").hide();
                        $("#dg").show();
                    }
                }
            });
            $("#dg").hide();
            $("#loading-1").show();
            $("#cjbtn").addClass("disabled");
        }

        function exportdata(){
            var cate_id=$("select[name=cate_id]").find("option:selected").val();
            if(cate_id==0){
                alert('请选择栏目！');
                return false;
            }
            var id={$id};//当前节点id
            $.ajax({
                type:"post",
                dataType:"json",
                data:{id:id,cate_id:cate_id},
                url:"{:url('Note/exportdata')}",
                success:function(data){
                    if(data==1){
                      $("#export").removeClass("disabled");
                      $("#export_data").hide();
                      $("#export_done").show();
                    }
                }
            });
            $("#dg").hide();
            $("#export_done").hide();
            $("#export_data").show();
            $("#export").addClass("disabled");
            $("#cjbtn").addClass("disabled");
        }

        
    </script>


</body></html>